package cn.iocoder.yudao.module.ai.dal.mysql.creationmodel;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ai.dal.dataobject.creationmodel.CreationModelDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 创作模型 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CreationModelMapper extends BaseMapperX<CreationModelDO> {

    default PageResult<CreationModelDO> selectPage(PageParam reqVO, Long categoryId) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CreationModelDO>()
            .eq(CreationModelDO::getCategoryId, categoryId)
            .orderByDesc(CreationModelDO::getId));
    }

    default int deleteByCategoryId(Long categoryId) {
        return delete(CreationModelDO::getCategoryId, categoryId);
    }

}